.class public Lcom/brixd/niceapp/service/LoginService;
.super Ljava/lang/Object;
.source "LoginService.java"


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lcom/brixd/niceapp/service/LoginService$SNSPlatform;
    }
.end annotation


# static fields
.field private static mHandler:Landroid/os/Handler;

.field private static mLoginDialog:Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;

.field private static mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 35
    new-instance v0, Landroid/os/Handler;

    invoke-direct {v0}, Landroid/os/Handler;-><init>()V

    sput-object v0, Lcom/brixd/niceapp/service/LoginService;->mHandler:Landroid/os/Handler;

    return-void
.end method

.method public constructor <init>()V
    .registers 1

    .prologue
    .line 33
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 38
    return-void
.end method

.method static synthetic access$000(Landroid/content/Context;)V
    .registers 1
    .param p0, "x0"    # Landroid/content/Context;

    .prologue
    .line 33
    invoke-static {p0}, Lcom/brixd/niceapp/service/LoginService;->hideLoadingDialog(Landroid/content/Context;)V

    return-void
.end method

.method static synthetic access$100()Landroid/os/Handler;
    .registers 1

    .prologue
    .line 33
    sget-object v0, Lcom/brixd/niceapp/service/LoginService;->mHandler:Landroid/os/Handler;

    return-object v0
.end method

.method static synthetic access$200(Landroid/content/Context;)V
    .registers 1
    .param p0, "x0"    # Landroid/content/Context;

    .prologue
    .line 33
    invoke-static {p0}, Lcom/brixd/niceapp/service/LoginService;->hideLoginDialog(Landroid/content/Context;)V

    return-void
.end method

.method public static authorize(Landroid/content/Context;Lcn/sharesdk/framework/Platform;)V
    .registers 5
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "platform"    # Lcn/sharesdk/framework/Platform;

    .prologue
    .line 61
    invoke-static {p0}, Lcom/brixd/niceapp/service/LoginService;->showLoadingDialog(Landroid/content/Context;)V

    .line 63
    new-instance v0, Lcom/brixd/niceapp/service/LoginService$1;

    invoke-direct {v0, p0, p1}, Lcom/brixd/niceapp/service/LoginService$1;-><init>(Landroid/content/Context;Lcn/sharesdk/framework/Platform;)V

    invoke-virtual {p1, v0}, Lcn/sharesdk/framework/Platform;->setPlatformActionListener(Lcn/sharesdk/framework/PlatformActionListener;)V

    .line 105
    sget-object v0, Lcn/sharesdk/sina/weibo/SinaWeibo;->NAME:Ljava/lang/String;

    invoke-virtual {p1}, Lcn/sharesdk/framework/Platform;->getName()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v0

    if-eqz v0, :cond_23

    .line 106
    const/4 v0, 0x1

    new-array v0, v0, [Ljava/lang/String;

    const/4 v1, 0x0

    const-string v2, "follow_app_official_microblog"

    aput-object v2, v0, v1

    invoke-virtual {p1, v0}, Lcn/sharesdk/framework/Platform;->authorize([Ljava/lang/String;)V

    .line 111
    :goto_22
    return-void

    .line 108
    :cond_23
    invoke-virtual {p1}, Lcn/sharesdk/framework/Platform;->authorize()V

    goto :goto_22
.end method

.method private static hideLoadingDialog(Landroid/content/Context;)V
    .registers 2
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 173
    sget-object v0, Lcom/brixd/niceapp/service/LoginService;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    if-eqz v0, :cond_e

    if-eqz p0, :cond_e

    .line 174
    sget-object v0, Lcom/brixd/niceapp/service/LoginService;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    invoke-virtual {v0}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->dismiss()V

    .line 175
    const/4 v0, 0x0

    sput-object v0, Lcom/brixd/niceapp/service/LoginService;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    .line 177
    :cond_e
    return-void
.end method

.method private static hideLoginDialog(Landroid/content/Context;)V
    .registers 2
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 159
    sget-object v0, Lcom/brixd/niceapp/service/LoginService;->mLoginDialog:Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;

    if-eqz v0, :cond_11

    sget-object v0, Lcom/brixd/niceapp/service/LoginService;->mLoginDialog:Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;

    invoke-virtual {v0}, Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;->isShowing()Z

    move-result v0

    if-eqz v0, :cond_11

    .line 160
    sget-object v0, Lcom/brixd/niceapp/service/LoginService;->mLoginDialog:Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;

    invoke-virtual {v0}, Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;->dismiss()V

    .line 162
    :cond_11
    return-void
.end method

.method public static login(Landroid/content/Context;Ljava/lang/String;)V
    .registers 3
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "tips"    # Ljava/lang/String;

    .prologue
    .line 51
    invoke-static {p0}, Lcn/sharesdk/framework/ShareSDK;->initSDK(Landroid/content/Context;)V

    .line 52
    invoke-static {p1}, Landroid/text/TextUtils;->isEmpty(Ljava/lang/CharSequence;)Z

    move-result v0

    if-eqz v0, :cond_16

    .line 53
    new-instance v0, Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;

    invoke-direct {v0, p0}, Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcom/brixd/niceapp/service/LoginService;->mLoginDialog:Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;

    .line 57
    :goto_10
    sget-object v0, Lcom/brixd/niceapp/service/LoginService;->mLoginDialog:Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;

    invoke-virtual {v0}, Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;->show()V

    .line 58
    return-void

    .line 55
    :cond_16
    new-instance v0, Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;

    invoke-direct {v0, p0, p1}, Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;-><init>(Landroid/content/Context;Ljava/lang/String;)V

    sput-object v0, Lcom/brixd/niceapp/service/LoginService;->mLoginDialog:Lcom/brixd/niceapp/userinfo/activity/UserLoginDialog;

    goto :goto_10
.end method

.method private static showLoadingDialog(Landroid/content/Context;)V
    .registers 5
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 165
    sget-object v0, Lcom/brixd/niceapp/service/LoginService;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    if-nez v0, :cond_12

    .line 166
    const-string v0, ""

    const v1, 0x7f040003

    const/4 v2, 0x0

    const/4 v3, 0x0

    invoke-static {p0, v0, v1, v2, v3}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->show(Landroid/content/Context;Ljava/lang/CharSequence;IZLandroid/content/DialogInterface$OnCancelListener;)Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    move-result-object v0

    sput-object v0, Lcom/brixd/niceapp/service/LoginService;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    .line 170
    :goto_11
    return-void

    .line 168
    :cond_12
    sget-object v0, Lcom/brixd/niceapp/service/LoginService;->mProgressHUD:Lcom/zuiapps/suite/utils/hud/ProgressHUD;

    invoke-virtual {v0}, Lcom/zuiapps/suite/utils/hud/ProgressHUD;->show()V

    goto :goto_11
.end method

.method public static signupUser(Landroid/content/Context;Lcom/brixd/niceapp/service/LoginService$SNSPlatform;Ljava/lang/String;Ljava/lang/String;J)V
    .registers 14
    .param p0, "context"    # Landroid/content/Context;
    .param p1, "snsType"    # Lcom/brixd/niceapp/service/LoginService$SNSPlatform;
    .param p2, "uid"    # Ljava/lang/String;
    .param p3, "accessToken"    # Ljava/lang/String;
    .param p4, "expiresIn"    # J

    .prologue
    .line 115
    invoke-static {p0}, Lcom/brixd/niceapp/service/adapter/ReqRestAdapter;->niceAppAdapter(Landroid/content/Context;)Lretrofit/RestAdapter;

    move-result-object v1

    const-class v2, Lcom/brixd/niceapp/service/restful/UserRestfulRequest;

    invoke-virtual {v1, v2}, Lretrofit/RestAdapter;->create(Ljava/lang/Class;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/brixd/niceapp/service/restful/UserRestfulRequest;

    .line 116
    .local v0, "userRestfulRequest":Lcom/brixd/niceapp/service/restful/UserRestfulRequest;
    new-instance v6, Lcom/brixd/niceapp/service/LoginService$2;

    invoke-direct {v6, p1, p0}, Lcom/brixd/niceapp/service/LoginService$2;-><init>(Lcom/brixd/niceapp/service/LoginService$SNSPlatform;Landroid/content/Context;)V

    .line 155
    .local v6, "callback":Lretrofit/Callback;, "Lretrofit/Callback<Lorg/json/JSONObject;>;"
    invoke-virtual {p1}, Lcom/brixd/niceapp/service/LoginService$SNSPlatform;->name()Ljava/lang/String;

    move-result-object v1

    move-object v2, p2

    move-object v3, p3

    move-wide v4, p4

    invoke-interface/range {v0 .. v6}, Lcom/brixd/niceapp/service/restful/UserRestfulRequest;->signup(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;JLretrofit/Callback;)V

    .line 156
    return-void
.end method
